package com.wmm.fast.main.shop2Observer;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;

/**
 * @Auther: wangzun
 * @Date: 2018/9/12 14:35
 * @Description: 抽象观察者
 */
@Data
@Slf4j
public class ConcrateObserver extends Observer {

    private String name;
    private Subject subject;
    private String observerState;

    public ConcrateObserver(ConcrateSubject subject,String name) {
        this.subject = subject;
        this.name = name;
    }

    @Override
    public void update() {
        observerState = subject.getSubjectState();
        log.info("观察者{}的新状态是{}",name,observerState);
    }
}
